class CubeType {

	static belongsTo = [world:World]

	String name
	
	SLGState center
	
	SLGState floor
	
	SLGState ceiling
	
	SLGState north
	
	SLGState south
	
	SLGState west
	
	SLGState east
	
	static constraints = {
		center(nullable:true)
		floor(nullable:true)
		ceiling(nullable:true)
		north(nullable:true)
		south(nullable:true)
		west(nullable:true)
		east(nullable:true)
	}
	
	boolean free() {
		return !center || center == SLGState.GASEOUS
	}
	
	boolean directionFree(direction) {
		switch(direction) {
			case Direction.FLOOR : return !floor || floor == SLGState.GASEOUS
			case Direction.CEILING : return !ceiling || ceiling == SLGState.GASEOUS
			case Direction.NORTH : return !north || north == SLGState.GASEOUS
			case Direction.SOUTH : return !south || south == SLGState.GASEOUS
			case Direction.WEST : return !west || west == SLGState.GASEOUS
			case Direction.EAST : return !east || east == SLGState.GASEOUS
		}
	}
}